from selenium import webdriver
import time


path = 'chromedriver.exe'
browser = webdriver.Chrome(path)

url = 'https://www.baidu.com/'
browser.get(url)

input = browser.find_element_by_id('kw')
input.send_keys('周杰伦')
time.sleep(5)

button = browser.find_element_by_id('su')
button.click()
time.sleep(5)

js_button = 'document.documentElement.scrollTop=100000'
browser.execute_script(js_button)
time.sleep(5)

next = browser.find_element_by_xpath('//a[@class="n"]')
next.click()
time.sleep(10)

browser.back()
time.sleep(5)

browser.forward()
time.sleep(5)

browser.quit()


